<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<jsp:useBean id="JSONRPCBridge" scope="session" class="com.metaparadigm.jsonrpc.JSONRPCBridge" />
<jsp:useBean id="example" scope="session" class="jsonRpc.Example" />
<%
JSONRPCBridge.registerObject("example", example);
%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
   
    <title>My JSP 'jsonrpc.jsp' starting page</title>
   
 <meta http-equiv="pragma" content="no-cache">
 <meta http-equiv="cache-control" content="no-cache">
 <meta http-equiv="expires" content="0">   
 <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
 <meta http-equiv="description" content="This is my page">
 <!--
 <link rel="stylesheet" type="text/css" href="styles.css">
 -->
 
 <script type="text/javascript" src="js/util/jsonrpc.js"></script> 
 <script type="text/javascript">

 <!--jsonrpc 客户端JS代码 -->
 var jsonrpc=null;
 function onLoad(){
  jsonrpc=new JSONRpcClient("JSON-RPC"); 
 }
  
 function aboutme_1(){
  var str1=jsonrpc.example.aboutMe();
  alert(str1); 
 }


 function aboutme_2(name,age){
  var user={"javaclass":"test.User","name":name,"age":age};
  var str2=jsonrpc.example.aboutMe(user);
  alert(str2);
 } 
 
 </script>

  </head>
 
  <body onload="onLoad()">
    JSON RPC 测试页，通过JS异步获取远程服务器后台信息，在IE上显示。
    <br>
    <br>
    异步调用后台数据，在前台显示
    <input type=button id="aboutme_1" value=" show aboutme" onclick="aboutme_1()"><br><br>
    通过客户端传入的信息，构造一个对象，传到后台，再在前台显示
    <input type=button id="aboutme_2" value=" show aboutme" onclick="aboutme_2('李四','32')">
  </body>
</html>